import { ImageResponse } from 'next/og'; import { ogMark } from '@/components/layout/logo'; import { publicProfile } from '@/lib/account/queries'; import { summarizePortfolio } from '@/lib/account/portfolio'; import { fmtMoney } from '@/lib/format'; export const runtime = 'nodejs'; export const alt = 'RareIndex collector profile'; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; export default async function Image({ params }: { params: Promise<{ handle: string }> }) { const { handle } = await params; const p = await publicProfile(handle); const name = p?.user.name ?? `@${handle}`; const total = p ? summarizePortfolio(p.items) : null; const top = total?.allocationByFamily.slice(0, 3).map((b) => b.label).join(' · ') ?? ''; return new ImageResponse( (
{ogMark(40)} RareIndex · collector profile
{name}
@{handle}{top ? ` · ${top}` : ''}
Public collection value
{total?.valuedCount ? fmtMoney(total.valueUsd) : '—'}
{total ? `${total.itemCount} items · ${p?.collections.length ?? 0} collections` : ''}
), { ...size }, ); }